import java.util.Scanner;

/**
 * 统计大写字母个数
 * 找出给定字符串中大写字符(即'A'-'Z')的个数。
 */
public class HJ84 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int count = 0;
            String s = scanner.nextLine();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if(c>='A' && c<='Z'){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
